× CER (Course and Examination Regulations) IR (Implementation Regulations) HZ Learn HZ Teams Study Progress Github HZ

articles in sections or not?

Should article tags be inside sections tags or the other way around?

Articles

Nesting article in section or Vice Versa?

The "article" element specifies independent, self-contained content.


The "section" element defines section in a document.


Can we use the definitions to decide how to nest those elements? No, we cannot!


So, you will find HTML pages with "section" elements containing "article" elements, and "article" elements containing "section" elements.


Source: W3Schools
Can article and section be nested inside each other? How do they behave and what's the basic difference between them?

Html5 header, article, section, aside, footer tags behaves just like plain div tag.


They are used for giving hints to SEO, screen readers what type of content the divisions contain.


Source: sololearn
Is it semantically correct to nest "article" tags in such a manner?

There are cases where nesting article elements is correct; the most prominent case being comments to a blog post.


Good questions to ask whether article is appropriate:

  • could the content have an own publication date?
  • could the content have a different author than the page?
  • could the content be a separate entry in a feed?
  • would the content still make sense if it was printed out without any other content/context?

If (some of) these questions are answered with 'yes', article could be correct.


Source: stackOverflow

My Conclussion

In conclusion for the reader it does not really matter if it is nested and in what order if done so. Mostly it is important for the Search Engine (SEO) and for screen readers. As long as "articles" have a purpose of a real-life article (like having an own publish date) then it is wise to use that tag too.